Skip to contentSkip to conversation

Change in openvpn[master]: Prevent NULL pointer dereference with --dns-updown

Openvpn-devel In review d12fk (Code Review) 2 participants 6 messages Jan 27 – Jan 28 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1769556650000.Id530d890ba01cffb74d3dc04ad10b153f7bea1d4@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1498?usp=email

to review the following change.

Change subject: Prevent NULL pointer dereference with --dns-updown
......................................................................

Prevent NULL pointer dereference with --dns-updown

If the dns-updown option appears in the config twice, there is a chance of a NULL pointer dereference when comparing the script path to the default script path. This happens when a custom script is set, after the dns-updown script was disabled first. In that case the script path is NULL, which leads to the deref during a strcmp(3).

Change-Id Id530d890ba01cffb74d3dc04ad10b153f7bea1d4

---
M src/openvpn/options.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/1498/1

src/openvpn/options.c +1 -1
index 85669e0..2bca647 100644
@@ -7890,7 +7890,7 @@
         }
         else
         {
-            if (streq(dns->updown, DEFAULT_DNS_UPDOWN))
+            if (dns->updown && streq(dns->updown, DEFAULT_DNS_UPDOWN))
             {
                 /* Unset the default command to prevent warnings */
                 dns->updown = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1498?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id530d890ba01cffb74d3dc04ad10b153f7bea1d4
Gerrit-Change-Number: 1498
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk.

plaisthos has posted comments on this change by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1498?usp=email )

Change subject: Prevent NULL pointer dereference with --dns-updown
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1498?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id530d890ba01cffb74d3dc04ad10b153f7bea1d4
Gerrit-Change-Number: 1498
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Wed, 28 Jan 2026 10:59:35 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 Prevent NULL pointer dereference with --dns-updown

In reply to a message not in the archive

From: Heiko Hund <[email protected]...>

If the dns-updown option appears in the config twice, there is a chance of a NULL pointer dereference when comparing the script path to the default script path. This happens when a custom script is set, after the dns-updown script was disabled first. In that case the script path is NULL, which leads to the deref during a strcmp(3).

Change-Id Id530d890ba01cffb74d3dc04ad10b153f7bea1d4

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1498
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1498
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>

src/openvpn/options.c +1 -1
index 85669e0..2bca647 100644
@@ -7890,7 +7890,7 @@
         }
         else
         {
-            if (streq(dns->updown, DEFAULT_DNS_UPDOWN))
+            if (dns->updown && streq(dns->updown, DEFAULT_DNS_UPDOWN))
             {
                 /* Unset the default command to prevent warnings */
                 dns->updown = NULL;
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: Prevent NULL pointer dereference with --dns-updown

Thanks for the quick fix (and compliments to SR Labs for finding all these...).

For the sake of the archives - while this is a NULL-pointer crashbug, it can not be pushed or triggered "from the outside", so it does not get a CVE, it's just a bug.

The BBs do "does it compile and does t_client with --dns-updown work?" tests, and this is all green, so I didn't do more than stare-at-code for a bit.

It's also not in 2.6.x, so no backporting needed.

Your patch has been applied to the master branch.

commit 62a17417de26735e04cb527c5df8137e4d50454a

Author: Heiko Hund
Date:   Wed Jan 28 12:04:37 2026 +0100
     Prevent NULL pointer dereference with --dns-updown

     Signed-off-by: Heiko Hund <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1498
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg35479.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1498?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by plaisthos

Change subject: Prevent NULL pointer dereference with --dns-updown
......................................................................

Prevent NULL pointer dereference with --dns-updown

If the dns-updown option appears in the config twice, there is a chance of a NULL pointer dereference when comparing the script path to the default script path. This happens when a custom script is set, after the dns-updown script was disabled first. In that case the script path is NULL, which leads to the deref during a strcmp(3).

Change-Id Id530d890ba01cffb74d3dc04ad10b153f7bea1d4

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1498
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35479.html

---
M src/openvpn/options.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/1498/2

src/openvpn/options.c +1 -1
index 85669e0..2bca647 100644
@@ -7890,7 +7890,7 @@
         }
         else
         {
-            if (streq(dns->updown, DEFAULT_DNS_UPDOWN))
+            if (dns->updown && streq(dns->updown, DEFAULT_DNS_UPDOWN))
             {
                 /* Unset the default command to prevent warnings */
                 dns->updown = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1498?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id530d890ba01cffb74d3dc04ad10b153f7bea1d4
Gerrit-Change-Number: 1498
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1498?usp=email )

Change subject: Prevent NULL pointer dereference with --dns-updown
......................................................................

Prevent NULL pointer dereference with --dns-updown

If the dns-updown option appears in the config twice, there is a chance of a NULL pointer dereference when comparing the script path to the default script path. This happens when a custom script is set, after the dns-updown script was disabled first. In that case the script path is NULL, which leads to the deref during a strcmp(3).

Change-Id Id530d890ba01cffb74d3dc04ad10b153f7bea1d4

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1498
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35479.html

---
M src/openvpn/options.c

1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/options.c +1 -1
index 85669e0..2bca647 100644
@@ -7890,7 +7890,7 @@
         }
         else
         {
-            if (streq(dns->updown, DEFAULT_DNS_UPDOWN))
+            if (dns->updown && streq(dns->updown, DEFAULT_DNS_UPDOWN))
             {
                 /* Unset the default command to prevent warnings */
                 dns->updown = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1498?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id530d890ba01cffb74d3dc04ad10b153f7bea1d4
Gerrit-Change-Number: 1498
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>